package gl.android.xmppandroidclient.server;

import gl.android.util.NotificationUtil;
import gl.android.xmppandroidclient.common.Constant;
import gl.android.xmppandroidclient.common.XmppState;
import gl.android.xmppandroidclient.server.interfaces.XmppStateHandler;
import android.content.Context;

public class AndroidXmppStateHandler implements XmppStateHandler {
	private Context Context;

	AndroidXmppStateHandler(Context context) {
		this.Context = context;
	}

	@Override
	public void handler(XmppState state, String message) {

		switch (state) {
		case OFFLINE:
			NotificationUtil.sendPersistenceNotification(Context,
					message + ":", state.toString(),
					Constant.Activity_Action_LOGIN);
			break;
		case ONLINE:
			NotificationUtil.sendPersistenceNotification(Context,
					message + ":", state.toString(),
					Constant.Activity_Action_Create_Message);
			break;
		case CONNECTING:
			NotificationUtil.sendPersistenceNotification(Context,
					message + ":", state.toString(),
					Constant.Activity_Action_LOGIN);
			break;
		case KICKOUT:
			NotificationUtil.sendPersistenceNotification(Context,
					message + ":", state.toString(),
					Constant.Activity_Action_LOGIN);
			break;
		}
	}

}
